package com.livedocumentation.client.web.header;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.TextBox;

/**
 * Execute searching on all the topics of this help.
 * 
 * @Feature
 */
public class SearchBox extends HorizontalPanel {

	public SearchBox() {

		this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

		this.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

		this.setSpacing(5);

		final TextBox text = new TextBox();

		// text.setTitle(HelpHint.getHelpHint(this.getClass()));

		this.add(text);

		HTML searchIcon = getSearchIcon();

		this.add(searchIcon);
	}

	public static HTML getSearchIcon() {

		HTML img = new HTML("<a href='#'><img src='/images/search.gif'></a>");

		// img.setTitle(HelpHint.getHelpHint(this.getClass()));

		img.setTitle("Search");

		img.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {

			}
		});

		return img;
	}

}